<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductsTable extends Migration
{
	public function up()
	{
		Schema::create('products', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('company_id')->unsigned()->index()->comment('商家ID');
            $table->string('name')->index()->comment('产品名称');
            $table->string('thumbnail')->nullable()->comment('产品图片');
            $table->float('rating', 3, 1)->default(5.0)->comment('商品评分');
            $table->integer('review_count')->default(0)->comment('评价数量');
            $table->text('description')->nullable()->comment('描述信息');
            $table->decimal('price', 10, 2)->default(0)->comment('价格');
            $table->boolean('delflag')->default(false)->comment('删除标志');
            $table->timestamps();
        });
	}

	public function down()
	{
		Schema::drop('products');
	}
}
